package com.pure.common.utils;

import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;

/**
 * @description: SpelExpressionParser()
 * @date: 2022-06-06 14:59
 * @since 1.2.0
 **/
public class ExpressionParserUtil {

    private static final ExpressionParser SpEL_PARSER = new SpelExpressionParser();

    public static void main(String[] args) {

        int n = 3;
        String exp = "'【' + " + n + " == 1 ? '换货' : " + n + " == 2 ? '退货' : '要货' + '订单关闭】推送失败原因'";
        String expression = (String) SpEL_PARSER.parseExpression(exp).getValue();
        System.out.println(expression);
    }

}
